{* advanced search in category *}

<TABLE BGCOLOR="{$smarty.const.CONF_LIGHT_COLOR}" CELLPADDING="3">

<form name='AdvancedSearchInCategory' method=GET>

<TR><TD>

<p align="left">
	{if $categories_to_select}
		<h5>{$smarty.const.STRING_ADVANCED_SEARCH_IN_CATEGORY}</h5>
	{else}
		<h5>{$smarty.const.STRING_SELECT_PRODUCT_BY_PARAMS}</h5>
	</strong>		
	{/if}
</p>



	<input type=hidden name='categoryID' value='{$categoryID}'>
	{if $categories_to_select}
		<input type=hidden name='search_with_change_category_ability' value='yes'>
	{else}
		<input type=hidden name='search' value='1'>
	{/if}

<table border="0" cellspacing="0" cellpadding="2">

	{if $categories_to_select}
	<tr>
		<td align="left">
			{$smarty.const.STRING_CATEGORY}:
		</td>
		<td align="left">
			<select name='categorySelect' onchange='JavaScript:_categoryChangedHandler()'>
			{if !$categoryID}<option value='0'>{$smarty.const.ADMIN_PROMPT_TO_SELECT}</option>{/if}
			{section name=i loop=$categories_to_select}
				<option value='{$categories_to_select[i].categoryID}'
				{if $categories_to_select[i].categoryID == $categoryID}
					selected
				{/if}
				>
					{section name=j max=$categories_to_select[i].level}
						&nbsp;&nbsp;&nbsp;
					{/section}
						{$categories_to_select[i].name}
				</option>
			{/section}
			</select>

			{literal}
			<script language='JavaScript'>
				function _categoryChangedHandler()
				{
					if (document.AdvancedSearchInCategory.categorySelect.value != 0)
					window.location = 'index.php?categoryID=' + 
						document.AdvancedSearchInCategory.categorySelect.value +
						'&search_with_change_category_ability=yes';
				}
			</script>
			{/literal}
		</td>
	</tr>
	{/if}


	{if $categoryID}
	<tr>
		<td align="left">
			{$smarty.const.STRING_NAME}:
		</td>
		<td align="left">
			<input type="text" name="search_name" 
					value="{$search_name|replace:'"':'&quot;'|replace:"\'":"'"|replace:"<":"&lt;"|replace:">":"&gt;"|default:""}">
		</td>
	</tr>
	<tr> 
		<td align="left">
			{$smarty.const.STRING_PRODUCT_PRICE}:
		</td>
		<td align="left">
			{$smarty.const.STRING_PRICE_FROM}
			<input name="search_price_from" type="text" size="10"
					value="{$search_price_from|replace:'"':'&quot;'|replace:"\'":"'"|replace:"<":"&lt;"|replace:">":"&gt;"|default:""}" > {$priceUnit}<br>
				{$smarty.const.STRING_PRICE_TO}
			<input name="search_price_to" type="text" size="10" 
					value="{$search_price_to|replace:'"':'&quot;'|replace:"\'":"'"|replace:"<":"&lt;"|replace:">":"&gt;"|default:""}" > {$priceUnit}

		</td>
	</tr>
	{/if}

				{section name=i loop=$params}
					<tr>

						<td>
							{$params[i].name}:
						</td>
						<td>
							{if $params[i].controlIsTextField eq 1}
								<input type=text name='param_{$params[i].optionID}' 
									value='{$params[i].value|replace:'"':'&quot;'|replace:"\'":"'"|replace:"<":"&lt;"|replace:">":"&gt;"|default:""}'>
							{else}
								<select name='param_{$params[i].optionID}'>
									<option value='0'>{$smarty.const.STRING_UNIMPORTANT}</option>
									{section name=j loop=$params[i].variants}
									<option value='{$params[i].variants[j].variantID}'
										{if $params[i].value == $params[i].variants[j].variantID}
											selected
										{/if}
									>
										{$params[i].variants[j].value|replace:'"':'&quot;'|replace:"\'":"'"|replace:"<":"&lt;"|replace:">":"&gt;"|default:""}
									</option>
									{/section}
								</select>
							{/if}
						</td>
					</tr>
				{/section}


	{if $show_subcategory_checkbox}
	<tr>
		<td colspan=2>

			{if $show_subcategories_products}
				<input type=hidden value='1' name='search_in_subcategory'>
			{else}
				<input type=checkbox value='1' name='search_in_subcategory'
				{if $search_in_subcategory}
					checked
				{/if}
				> 
				{$smarty.const.STRING_SEARCH_IN_SUBCATEGORIES}
			{/if}

		</td>
	</tr>
	{/if}

	{if $categoryID}
	<tr>
		<td colspan=2 align="right">
			<input type=submit 
				value='{$smarty.const.FIND_BUTTON}' 
				name='advanced_search_in_category'>
		</td>
	</tr>
	{/if}

</table>

</TD></TR>
</form>
</TABLE>